/*--------------------------------------------------------------------------------*/
#ifndef __LINE_PARSER__
#define __LINE_PARSER__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include <cstdio>
/*--------------------------------------------------------------------------------*/
class LINE_PARSER
{
	// -- PUBLIC

public:

    // .. CONSTRUCTORS

    LINE_PARSER( const TEXT & model );

    ~LINE_PARSER();

    // .. METHODS

    BOOL Parse( const TEXT & line );

    TEXT & GetText( INDEX index )
    {
    	return DataTable[ index ];
    }

    INT GetInteger( INDEX index )
    {
    	INT
			value;

    	sscanf( DataTable[ index ].GetArray(), "%d", &value );

    	return value;
    }

    REAL GetReal( INDEX index )
    {
    	REAL
			value;

    	sscanf( DataTable[ index ].GetArray(), "%f", &value );

    	return value;
    }

    // -- PRIVATE

private :

    // .. ATTRIBUTES

    TEXT
		ModelLine;
    ARRAY< TEXT >
		DataTable;
};
/*--------------------------------------------------------------------------------*/
#endif
